import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  { path: '/login', name: '登录', component: () => import('../view/LoginFrom.vue') },
  { path: '/homepage', name: '主页', component: () => import('../view/HomePage.vue') },
  { path: '/register', name: '注册', component: () => import('../view/RegisterFrom.vue') },
  { path: '/gonggao', name: '信息公告', component: () => import('../view/GongGao.vue') },
  { path: '/gongshi', name: '信息公示', component: () => import('../view/GongShi.vue') },
  { path: '/selection', name: '地区选择', component: () => import('../view/RegionalSelection.vue') },
  { path: '/shifanpt', name: '示范平台申报', component: () => import('../view/ShifanPT.vue') },
  { path: '/shifanjd', name: '示范基地申报', component: () => import('../view/ShifanJD.vue') },
  { path: '/ruzhujg', name: '入住机构申报', component: () => import('../view/RuzhuJg.vue') },
  { path: '/detail', name: '公告公示(详情)', component: () => import('../view/DeTail.vue') },
  { path: '/countnum', name: '通过数量', component: () => import('../view/CountNum.vue') },
  { path: '/zixun', name: '咨询服务', component: () => import('../view/ZiXun.vue') },
  { path: '/jianyi', name: '意见建议', component: () => import('../view/JianYi.vue') },
  { path: '/tousu', name: '实名投诉', component: () => import('../view/TouSu.vue') },
  { path: '/zixundetail', name: '咨询(详情)', component: () => import('../view/ZiXundetail.vue') },
  { path: '/rongzi', name: '融资需求', component: () => import('../view/RongZi.vue') },
  { path: '/nianshen', name: '年审', component: () => import('../view/NianShen.vue') },
  { path: '/gerenCenter', name: '个人中心', component: () => import('../view/gerenCenter.vue'), 
  children: [
    {
      path: 'ptdetail',
      name: '示范平台详情',
      component: () => import('../view/shifanDetail/PintaiDetail.vue')
    },
    {
      path: 'ptlist',
      name: '示范平台',
      component: () => import('../view/shifanDetail/PT.vue')
    },
    {
      path: 'jddetail',
      name: '示范基地详情',
      component: () => import('../view/shifanDetail/JidiDetail.vue')
    },
    {
      path: 'rzdetail',
      name: '入住机构详情',
      component: () => import('../view/shifanDetail/RuzhuDetail.vue')
    },
    {
      path: 'qydetail',
      name: '企业认证详情',
      component: () => import('../view/shifanDetail/QyDetail.vue')
    },
   
    {
      path: 'nsdetail',
      name: '年审详情',
      component: () => import('../view/shifanDetail/NianShenDetail.vue')
    },
  ] },
  { path: '/qiyerenzhen', name: '企业认证', component: () => import('../view/QiyeRenzhen.vue') },
  { path: '/', redirect: '/login' },// 重定向到首页
  { path: '*', component: () => import('../view/404Notfound.vue') } // 匹配所有路径的 404 组件
]

const router = new VueRouter({
  mode: 'hash',
  scrollBehavior: () => ({
    y: 0
  }),
  routes,
  
})
router.beforeEach((to, from, next) => {
  if (to.name) {
    document.title = to.name;
  } else {
    document.title = '兰州市中小企业公共服务平台';
  }
  next();
});
export default router
